const {ipcRenderer} = require('electron');
const $ = require('../resources/jquery3-7-0.mini.js')

$("#pinnedImage").click(()=>{
    console.log('go click change')
    ipcRenderer.send('learn-return')
})

window.onload = async()=>{
    $("#showyuanmaHTML div:nth-child(1)").text(`<!DOCHTML html>`)
    $("#showyuanmaHTML div:nth-child(2)").text(`<html>`)
    $("#showyuanmaHTML div:nth-child(3)").text(` <head>`)
    $("#showyuanmaHTML div:nth-child(4)").text(`<script src="https://unpkg.com/vue@3/dist/vue.esm-browser.js"></script>`)
    $("#showyuanmaHTML div:nth-child(5)").text(`</head>`)
    $("#showyuanmaHTML div:nth-child(6)").text(`<body>`)
    $("#showyuanmaHTML div:nth-child(7)").text(`<div id="setValueId">`)
    $("#showyuanmaHTML div:nth-child(8)").text(`  <p>{{dataValue}}</p>`)
    $("#showyuanmaHTML div:nth-child(9)").text(`  <button @click="dataValue++">+1</button>`)
    $("#showyuanmaHTML div:nth-child(10)").text(`</div>`)
    $("#showyuanmaHTML div:nth-child(11)").text(`</body>`)
    $("#showyuanmaHTML div:nth-child(12)").text(`<script type="module">`)
    $("#showyuanmaHTML div:nth-child(13)").text(`import { createApp, ref } from 'https://unpkg.com/vue@3/dist/vue.esm-browser.js'`)
    $("#showyuanmaHTML div:nth-child(14)").text(`createApp({`)
    $("#showyuanmaHTML div:nth-child(15)").text(`setup(){`)
    $("#showyuanmaHTML div:nth-child(16)").text(`const dataValue = ref(0)`)
    $("#showyuanmaHTML div:nth-child(17)").text(`return{dataValue}`)
    $("#showyuanmaHTML div:nth-child(18)").text(`}`)
    $("#showyuanmaHTML div:nth-child(19)").text(`}).mount('#setValueId')`)
    $("#showyuanmaHTML div:nth-child(20)").text(`</script>`)
    $("#showyuanmaHTML div:nth-child(21)").text(`</html>`)

    $(".setValueViteBox1").text("npm create vite@latest")
    $(".setValueViteBox2").text("npm install")
    $(".setValueViteBox3").text("yarn create vite")
    $(".setValueViteBox4").text("yarn")

    $("#showyuanmaVite div:nth-child(1)").text(`<template>`)
    $("#showyuanmaVite div:nth-child(2)").text(`<p>{{dataValue}}</p>`)
    $("#showyuanmaVite div:nth-child(3)").text(` <button @click="dataValue++">+1</button>`)
    $("#showyuanmaVite div:nth-child(4)").text(`</tempate>`)
    $("#showyuanmaVite div:nth-child(5)").text(`<script setup>`)
    $("#showyuanmaVite div:nth-child(6)").text(`import { createApp, ref } from "vue"`)
    $("#showyuanmaVite div:nth-child(7)").text(`const dataValue = ref(0)`)
    $("#showyuanmaVite div:nth-child(8)").text(`</script>`)
    $("#showyuanmaVite div:nth-child(9)").text(`<style scoped>`)
    $("#showyuanmaVite div:nth-child(10)").text(`</style>`)
}

let changeProject1Num = true;
$(".messageBox .setValueBox .setValueBox1 .showyuanma").click(()=>{
    if(changeProject1Num){
        $(".messageBox .setValueBox .setValueBox1 .showyuanma").text("返回")
        $("#setValueId").css('display','none')
        $("#showyuanmaHTML").css('display','block')
        changeProject1Num = false
    }else{
        $(".messageBox .setValueBox .setValueBox1 .showyuanma").text("查看源码")
        $("#setValueId").css('display','block')
        $("#showyuanmaHTML").css('display','none')
        changeProject1Num = true
    }
})
let changeProject2Num = true;
$(".messageBox .setValueViteBox .setValueViteBox5 .showyuanma").click(()=>{
    if(changeProject2Num){
        $(".messageBox .setValueViteBox .setValueViteBox5 .showyuanma").text("返回")
        $("#setValueIdVite").css('display','none')
        $("#showyuanmaVite").css('display','block')
        changeProject2Num = false
    }else{
        $(".messageBox .setValueViteBox .setValueViteBox5 .showyuanma").text("查看源码")
        $("#setValueIdVite").css('display','block')
        $("#showyuanmaVite").css('display','none')
        changeProject2Num = true
    }
})